<div class="modal-body pageContent" >
	<div class="row">
        <div class="col-lg-12 col-lg-offset-2">
            <div class="upload" >
              <form action="/process/addProcessParameter" enctype="multipart/form-data" method='post' id="form1">
                <div class="form-group processName">
                    <label class="col-lg-12 control-label"><span class="indicator">*</span><span class="indicatorName">工序名称</span></label>
                    <div class="col-lg-12">
                        <input type="text" class="form-control" name="processName"  />
                        <input type="hidden" name="schemeId" value="{{schemeId}}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-12 control-label">附件</label>
                    <div class="col-lg-12">
                        <input type="file" name="parameterFile" />
                    </div>
                </div>
              </form>
            </div>
        </div>
    </div>
</div>
<div class="modal-footer pageFooter">
      <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      <button  class="btn btn-primary"  type="submit" >保存</button>  
</div>
<script type="text/javascript">
$(document).ready(function() {  
   $('.selectpicker').selectpicker();//初始化
   $('#form1').bootstrapValidator({
            message: '此值无效',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                processName: {
                    validators: {
                        notEmpty: {
                            message: '工序名称不能为空'
                        },
                    }
                },
            }
        })
        .on('success.form.bv', function(e) {
            e.preventDefault();
            var $form = $(e.target);
            var bv = $form.data('bootstrapValidator');
            var formData = new FormData($("#form1")[0]);  
             $.ajax({  
                  url: '/process/addProcessParameter' ,  
                  type: 'POST',  
                  data: formData,  
                  async: true,  
                  cache: false,  
                  contentType: false,  
                  processData: false,   
                  success: function (returndata) { 
                    if(returndata.length===9371){   //session超时返回的登录页面 避免接口返回的也是字符串不是json
                                location.href="/severError";
                    }else{
                        if(JSON.parse(returndata).statusCode==200){
                            toastr.success(JSON.parse(returndata).message+'!');
                            $('#addProcessModal').modal('hide');
                            $("#ProcessTable1").bootstrapTable('refresh');
                        }else{
                            toastr.warning(JSON.parse(returndata).message+'!');
                            // $('#addProcessModal').modal('hide');
                            // $("#ProcessTable1").bootstrapTable('refresh');
                        }
                    }
                  },  
                  error: function (result) { 
                    if(result.status===503||result.status===500){ 
                        $('#addProcessModal').modal('hide');
                        toastr.error(JSON.parse(returndata).message+'!');
                    } 
                    // toastr.error(JSON.parse(returndata).message+'!');
                    //     $('#addProcessModal').modal('hide');
                    //     $("#ProcessTable1").bootstrapTable('refresh');
                  }  
             });  
        });
});

</script>
